const app = getApp()
Page({
  data:{
    orderInfo:'',
    stateArr: ['待付款', '待发货', '已收货', '交易完成', '待审核', '已退款', '订单超时'],
    status:"",
    photo:'',
    goods:'',
    shipping_price:'',
    youfei:''
  },
  /**
  * 生命周期函数--监听页面加载
  */
  onLoad: function (options) {
    var that = this
    let sign = wx.getStorageSync('sign')
    console.log(" 生命周期函数", options)
    wx.request({
      url: app.urlData.getURL + "/index.php/Weshop/SApi/index/m/orderDetail/key/" + app.urlData.key + "/wid/" + app.urlData.wid + "/sign/" + sign,
      method: 'get',
      data: {
        order_id: options.id,
      },
      // header: { 'Content-Type': 'application/json' },
      success: (res) => {
        console.log(res.data.datas.order);
        // if (that.data.id == )
        that.setData({
          orderInfo: res.data.datas.order,
          youfei: res.data.datas.order.order_amount,
          status: res.data.datas.order.pay_status,
          photo: res.data.datas,
          goods: res.data.datas.goodsList,
          shipping_price: res.data.datas.order.shipping_price,
        })
        console.log("页面加载", this.data.goods)
        let youfei=  Number(that.data.youfei)
        let shipping_price = Number(that.data.shipping_price)
        that.setData({
          youfei: youfei + shipping_price
        })
      }
    })
  },
})
